package com.fank.current.queue.block;

import java.util.concurrent.BlockingQueue;
/**
 * 从队列中取出元素
 * @author Fanxk
 * @Date 2018年10月3日
 * @Version 1.0
 */
public class Consumer implements Runnable
{
	protected BlockingQueue queue = null;

	public Consumer(BlockingQueue queue)
	{
		this.queue = queue;
	}

	@Override
	public void run()
	{
		try
		{
			System.out.println(queue.take());
			System.out.println(queue.take());
			System.out.println(queue.take());
		} catch (InterruptedException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
}
